'''
Created on Jan 27, 2010

@author: christianp
'''
import unittest
from BruTile.RequestTms import RequestTms
from BruTile.TileInfo import TileInfo
from BruTile.TileIndex import TileIndex
from BruTile.ImageRequest import ImageRequest

class UImageRequest(unittest.TestCase):

    def test_get_image_from_server(self):
        print("UImageRequest: test_get_image_from_server")
        request_tms = RequestTms("http://a.tile.openstreetmap.org","png")
        tile_info = TileInfo()
        tile_info.set_tile_index(TileIndex(2,2,2))
        
        url = request_tms.get_uri(tile_info)
        self.assertEqual(url,"http://a.tile.openstreetmap.org/2/2/2.png","request_tms.get_uri(tile_info)")
        
        image_request = ImageRequest()
        image = image_request.get_image_from_server(url)
        print(type(image))
        image_type = str(type(image))
        self.assertEqual(image_type, "<class 'wx._core.Image'>", "type(image)")
        pass


if __name__ == "__main__":
    #import sys;sys.argv = ['', 'Test.testName']
    unittest.main()